home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 2003 June / macformat-130.iso / mac / Reviewed⁄Demos / Spearhead Demo / demota / pak1.pk3 / anim / newshoot.scr < prev    next >
Encoding:
Text File  |  2002-10-21  |  2.3 KB  |  75 lines

  1. // =============
  2. // Shoot Handler
  3. // =============
  4.  
  5. // Prototype script for implementation of new persistant-thread
  6. // animation scripting system. This is the test case that should
  7. // include reference to all new features needed for the new system.
  8. // The new system is designed to make the scripts read much more
  9. // like the flowcharts they are created from.
  10.  
  11. // Each animation script should initialize all of the handlers for
  12. // the actor. They may already be set, but there's no guarantee
  13. // what state the last handler left them in, so just set them all.
  14. // For most, it will be sufficient to set them to defaults, using
  15. // a line like this one. Some may want to override some after that,
  16. // and others may want to set them all directly on entry.
  17.  
  18. //exec ("anim/"+self.GuyType+"_inithandler.scr")
  19. waitexec "anim/default_inithandler.scr"
  20.  
  21. // Do any handler-specific local initialization here
  22.  
  23. // temp value to signal a reload. Value is reset after reload.
  24. local.BulletsLeft = 20
  25.  
  26. // Most handlers will run until externally killed. These will need
  27. // a while(1) structure for this.
  28.  
  29. while(1)
  30. {
  31.  
  32.     // select a random range of shots to take before doing something
  33.     // interesting. In this case, let's make it 3 to 5.
  34.     local.IamGoingToShotThisManyTimes = randomint(3) + 3
  35.  
  36.     for ( local.i = 0; local.i < local.IamGoingToShotThisManyTimes; local.i++ )
  37.     {
  38.             self setactionanim ( self.weapontype + "_shoot" ) -60 60 
  39.             local.BulletsLeft--
  40.             self setmotionanim (self.weapongroup + "_stand_alert_legs") //( "crouch_" + self.weapontype )
  41.             self waittill upperanimdone
  42.     }
  43.  
  44.     if ( randomint(100) < 50 )
  45.     {        
  46.             local.OldPain = self.painhandler
  47.             self.painhandler = anim/RightFallDownPainhandler.scr
  48.             self setmotionanim "walk_injured_right"
  49.             self setsynctime 0
  50.             self waittill flaggedanimdone
  51.             self.painhandler = local.OldPain
  52.     }
  53.     else
  54.     {
  55.             local.OldPain = self.painhandler
  56.             self.painhandler = anim/LeftFallDownPainhandler.scr
  57.             self setmotionanim "walk_injured_left"
  58.             self setsynctime 0
  59.             self waittill flaggedanimdone
  60.             self.painhandler = local.OldPain
  61.     }
  62.  
  63.     if ( local.BulletsLeft <= 0 )
  64.     {
  65.             local.OldPain = self.painhandler
  66.             self.painhandler = NULL
  67.             self setmotionanim kar98_reload
  68.             self waittill flaggedanimdone
  69.             local.BulletsLeft = 20
  70.             self.painhandler = local.OldPain
  71.     }
  72. }
  73.  
  74. end
  75.